package Weapons;

import game.Config.BulletFactory;

import org.newdawn.slick.geom.Vector2f;
/**
 * This class represents a Rocketgun in the game. The rocketgun
 * extends Weapon and can be fired.
 * When the Rocketgun is fired it spawns bullets that explode upon impact,
 * thus damaging multiple enemies.
 * @author Sebastian Isheden and Victor Beer
 *
 */
public class RocketGun extends Weapon{

	protected float explosionRadius;
	/**
	 * Creates a Rocketgun with given parameters.
	 * @param fireRate	The amount of times this weapon can fire per second.
	 * @param damage  The damage per shot of this weapon.
	 * @param bulletSpeed  The speed the fired bullets will traverse the screen.
	 * @param explosionRadius The explosion radius of the bullet when it explodes.
	 */
	public RocketGun(float fireRate, float damage, float bulletSpeed,float explosionRadius) {
		super(fireRate, damage, bulletSpeed);
		this.explosionRadius = explosionRadius;
	}
	/**
	 * Returns a copy of the Rocketgun.
	 */
	@Override
	public Weapon copy() {
		return new RocketGun(1/this.fireInterval,this.damage,this.bulletSpeed,this.explosionRadius);
		
	}
	@Override
	protected void spawnBullet(Vector2f position, Vector2f direction) {
		callFactory(position,direction);
		
	}
	@Override
	protected void callFactory(Vector2f position, Vector2f direction) {
		BulletFactory.createRocketBullet(this.damage, this.bulletSpeed, position,direction, this.explosionRadius);
	}

}
